Delivering interrupts directly to a virtual processor

ABSTRACT

Embodiments of apparatuses, methods, and systems for delivering an interrupt to a virtual processor are disclosed. In one embodiment, an apparatus includes an interface to receive an interrupt request, delivery logic, and exit logic. The delivery logic is to determine, based on an attribute of the interrupt request, whether the interrupt request is to be delivered to the virtual processor. The exit logic is to transfer control to a host if the delivery logic determines that the interrupt request is not to be delivered to the virtual processor.

BACKGROUND

1. Field

The present disclosure pertains to the field of information processing, and more particularly, to the field of handling interrupts in a virtualization environment.

2. Description of Related Art

Generally, the concept of virtualization in information processing systems allows multiple instances of one or more operating systems (each, an “OS”) to run on a single information processing system, even though each OS is designed to have complete, direct control over the system and its resources. Virtualization is typically implemented by using software (e.g., a virtual machine monitor, or a “VMM”) to present to each OS a “virtual machine” (“VM”) having virtual resources, including one or more virtual processors, that the OS may completely and directly control, while the VMM maintains a system environment for implementing virtualization policies such as sharing and/or allocating the physical resources among the VMs (the “virtualization environment”). Each OS, and any other software, that runs on a VM is referred to as a “guest” or as “guest software,” while a “host” or “host software” is software, such as a VMM, that runs outside of, and may or may not be aware of, the virtualization environment.

A physical processor in an information processing system may support virtualization, for example, by supporting an instruction to enter a virtualization environment to run a guest on a virtual processor (i.e., a physical processor under constraints imposed by a VMM) in a VM. In the virtualization environment, certain events, operations, and situations, such as external interrupts or attempts to access privileged registers or resources, may be “intercepted,” i.e., cause the processor to exit the virtualization environment so that a VMM may operate, for example, to implement virtualization policies. A physical processor may also support other instructions for maintaining a virtualization environment, and may include memory or register bits that indicate or control virtualization capabilities of the physical processor.

A physical processor supporting a virtualization environment may receive an interrupt request while a guest is running on a virtual processor within the virtual environment. Typically, the interrupt request would be intercepted and control would be transferred to a VMM to determine how to handle the interrupt. For example, an interrupt service routine may be called by the VMM, or the VMM may create a virtual interrupt and inject it into a VM to allow a guest to call an interrupt service routine. In many cases, the VM that is entered to call the interrupt service request may be the same VM that was exited to allow the VMM to intercept the interrupt request. For example, the interrupt request may have been generated by an input/output (“I/O”) device assigned to the same VM that was exited, or an interrupt request may be an inter-processor interrupt between two virtual processors in the same VM.

BRIEF DESCRIPTION OF THE FIGURES

The present invention is illustrated by way of example and not limitation in the accompanying figures.

FIG. 1 illustrates a virtualization environment, in which an embodiment of the present invention may operate.

FIG. 2 illustrates an embodiment of the present invention in a method for a VMM to initialize support for delivering an interrupt directly to a virtual processor.

FIG. 3 illustrates an embodiment of the present invention in a method for delivering an interrupt directly to a virtual processor.

DETAILED DESCRIPTION

Embodiments of apparatuses, methods, and systems for delivering interrupts directly to a virtual processor are described below. In this description, numerous specific details, such as component and system configurations, may be set forth in order to provide a more thorough understanding of the present invention. It will be appreciated, however, by one skilled in the art, that the invention may be practiced without such specific details. Additionally, some well known structures, circuits, and the like have not been shown in detail, to avoid unnecessarily obscuring the present invention.

The performance of a virtualization environment may be improved if the frequency of intercepted events is minimized. Embodiments of the invention may be used to support the delivery of an interrupt request to a virtual processor (“direct delivery”) without requiring interception by a VMM. Therefore, performance may be improved over a virtualization environment in which all interrupt requests are intercepted by a VMM.

FIG. 1 illustrates virtualization architecture 100, in which an embodiment of the present invention may operate. In FIG. 1, bare platform hardware 110 may be any data processing apparatus capable of executing any OS or VMM software. For example, bare platform hardware may be that of a personal computer, mainframe computer, portable computer, handheld device, set-top box, server, or any other computing system. Bare platform hardware 110 includes processor 120, memory 130, input/output (“I/O”) device 115, and chipset 111.

Processor 120 may be any type of processor, including a general purpose microprocessor, such as a processor in the Pentium® Processor Family, the Itanium® Processor Family, or other processor family from Intel Corporation, or another processor from another company, or a digital signal processor or microcontroller. Although FIG. 1 shows only one such processor 120, bare platform hardware 110 may include any number of processors, including any number of multicore processors, each with any number of execution cores, and any number of multithreaded processors, each with any number of threads.

Memory 130 may be static or dynamic random access memory, semiconductor-based read-only or flash memory, magnetic or optical disk memory, any other type of medium readable by processor 120, or any combination of such mediums. I/O device(s) 115 may represent any number of peripheral or I/O devices, such as a monitor, a keyboard, a mouse, a printer, a network interface, an information storage device, etc. Chipset 111 may be include any number of components that perform any number of tasks, such as system logic, bus control, bus interfacing, bus bridging, memory control, peripheral device control, peripheral device functions, system configuration, etc.

Processor 120, memory 130, I/O device(s) 115, and chipset 111 may be coupled to or communicate with each other according to any known approach, such as directly or indirectly through one or more buses, point-to-point, or other wired or wireless connections. Bare platform hardware 110 may also include any number of additional devices or connections.

In addition to bare platform hardware 100, FIG. 1 illustrates VMM 140, VMs 150 and 160, and guests 152, 154, 155, 162, 164, and 165. 100161 VMM 140 may be any software, firmware, or hardware host installed on or accessible to bare platform hardware 110, to present VMs, i.e., abstractions of bare platform hardware 110, to guests, or to otherwise create VMs, manage VMs, and implement virtualization policies within virtualization environment 100. In other embodiments, a host may be any VMM, hypervisor, OS, or other software, firmware, or hardware capable of controlling bare platform hardware 110. A guest may be any OS, any VMM, including another instance of VMM 140, any hypervisor, or any application or other software.

Each guest expects to access physical resources, such as processor and platform registers, memory, and input/output devices, of bare platform hardware 110, according to the architecture of the processor and the platform presented in the VM. FIG. 1 shows two VMs, 150 and 160, with guest OS 152 and guest applications 154 and 155 installed on VM 150 and guest OS 162 and guest applications 164 and 165 installed on VM 160. Although FIG. 1 shows only two VMs and two applications per VM, any number of VMs may be created, and any number of applications may run on each VM within the scope of the present invention.

A resource that can be accessed by a guest may either be classified as a “privileged” or a “non-privileged” resource. For a privileged resource, VMM 140 facilitates the functionality desired by the guest while retaining ultimate control over the resource. Non-privileged resources do not need to be controlled by VMM 140 and may be accessed directly by a guest.

Furthermore, each guest OS expects to handle various events such as exceptions (e.g., page faults, and general protection faults), interrupts (e.g., hardware interrupts and software interrupts), and platform events (e.g., initialization and system management interrupts). These exceptions, interrupts, and platform events are referred to collectively and individually as “events” herein. Some of these events are “privileged” because they must be handled by VMM 140 to ensure proper operation of VMs 150 and 160, protection of VMM 140 from guests, and protection of guests from each other.

At any given time, processor 120 may be executing instructions from VMM 140 or any guest, thus VMM 140 or the guest may be running on, or in control of, processor 120. When a privileged event occurs or a guest attempts to access a privileged resource, control may be transferred from the guest to VMM 140. The transfer of control from a guest to VMM 140 is referred to as a “VM exit” herein. After handling the event or facilitating the access to the resource appropriately, VMM 140 may return control to a guest. The transfer of control from VMM 140 to a guest is referred to as a “VM entry” herein.

In the embodiment of FIG. 1, processor 120 controls the operation of VMs 150 and 160 according to data stored in virtual machine control structure (“VMCS”) 132. VMCS 132 is a structure that may contain state of a guest or guests, state of VMM 140, execution control information indicating how VMM 140 is to control operation of a guest or guests, information regarding VM exits and VM entries, any other such information. Processor 120 reads information from VMCS 132 to determine the execution environment of a VM and constrain its behavior. In this embodiment, VMCS 132 is stored in memory 130. In some embodiments, multiple VMCSs are used to support multiple VMs. Although FIG. 1 shows VMCS 132 stored in memory 130, storing a VMCS in a memory is not required by the present invention.

Processor 120 may include interrupt controller 122 to receive, generate, prioritize, deliver, hold pending, or otherwise control or manage interrupt requests. For example, interrupt controller 122 may be a local Advanced Programmable Interrupt Controller (“APIC”) according to the architecture of the Pentium® Processor Family. Chipset 111 may also include interrupt controller 112 to receive, generate, prioritize, deliver, hold pending, or otherwise control or manage interrupt requests in addition to, connection with, or instead of interrupt controller 112. For example, interrupt controller 112 may be an I/O APIC. Processor 120 and/or chipset 111 may include any other interrupt controller, and/or any other processor, chipset, or component not shown in FIG. 1 may include an interrupt controller, and/or interrupt requests may be controlled or managed according to any other approach.

Processor 120 also includes interface 121, which may be a bus unit or any other unit, port, or interface to allow processor 120 to receive interrupt requests and interrupt vectors through any type of bus, point to point, or other connection, directly or through any other component, such as chipset 111. Interface 121 may be an internal interface, e.g., to receive interrupts requests from a local APIC, and/or an external interface, e.g., to receive interrupt requests from an external source.

Additionally, processor 120 includes control logic 125 to support virtualization, including the delivery of interrupts to virtual processors. Control logic 125 may be microcode, programmable logic, hard-coded logic, or any other form of control logic within processor 120. In other embodiments, control logic 125 may be implemented in any form of hardware, software, or firmware, such as a processor abstraction layer, within a processor or within any component accessible or medium readable by a processor, such as memory 130.

Control logic 125 causes processor 120 to execute method embodiments of the present invention, such as the method embodiments illustrated in below in FIGS. 2 and 3, for example, by causing processor 120 to include the execution of one or more micro-operations, e.g., to support virtualization, in its response to virtualization instructions or other instructions from a host or guest.

Control logic 125 includes interrupt acknowledge logic 126, interrupt delivery logic 127, interrupt redirect logic 128, and exit logic 129. Interrupt acknowledge logic 126 is to acknowledge interrupt requests, which in some embodiments may cause an interrupt vector to be delivered to processor 120. Interrupt delivery logic 127 is to determine whether interrupt requests are to be delivered to virtual processors. Interrupt redirection logic 128 is to redirect interrupts for delivery to virtual processors instead of physical processor 120, for example by translating physical interrupt vectors to virtual interrupt vectors. Exit logic 129 is to prepare for and cause VM exits if interrupt requests are not to be delivered to virtual processors. Each of these logic units may also perform additional functions, including those described as being performed by another of the logic units, and any or all of these logic units may be integrated into a single logic unit.

VMCS 132 may include fields, control bits, or other data structures to support virtualization, including the delivery of interrupts to virtual processors. These data structures may be checked or otherwise referred to by control logic 125 to determine how to manage a VM environment. For example, interrupt-assignment control bit 133 may be set to enable the direct delivery of interrupt requests to virtual processors, as described below. In this description of this embodiment, control bits are set to enable or cause a desired effect, where set means writing a logical one to the bit, but any logic convention or nomenclature may be used within the scope of the present invention.

Also in VMCS 132, address field 134 may be used to store an address of a memory location at which a data structure to indicate whether an interrupt is to be delivered to a virtual processor may be stored. For example, the address may be the 64-bit address of a 256-bit array that includes one configuration bit for each of up to 256 physical interrupt vectors. Similarly, address field 136 may be used to store an address of a memory location at which a data structure to provide a virtual interrupt vector may be stored. For example, the address may be a 64-bit address of a 256-byte array that includes a one-byte virtual interrupt vector for each of up to 256 physical interrupt vectors. In an alternative embodiment, VMCS 132 may include data structures to directly store such indicators or virtual interrupt vectors.

FIGS. 2 and 3 illustrate method embodiments of the present invention. Although method embodiments are not limited in this respect, reference is made to virtualization environment 100 of FIG. 1 to describe the method embodiments of FIGS. 2 and 3.

FIG. 2 illustrates an embodiment of the present invention in a method for a VMM to initialize support for delivering interrupts directly to virtual processors.

In box 210 of FIG. 2, VMM 140 of FIG. 1 creates a VMCS (e.g., VMCS 132) for a VM. In boxes 212 to 217, VMM 140 configures VMCS 132 to implement support for delivering an interrupt to a virtual processor. In box 212, interrupt-assignment control bit 133 is set to enable the direct delivery of interrupts to a virtual processor, as described below.

In box 214, an address of a memory location for storing a data structure to indicate whether an interrupt is to be delivered to the virtual processor is written to address field 134. Each of a certain number of potential interrupts (e.g., 256) may be identified by a physical interrupt vector. The data structure (e.g., interrupt bitmap 135) may include an entry for each of the physical interrupt vectors. Each entry may include a configuration bit to indicate whether the physical interrupt corresponding to each physical interrupt vector is to be delivered to the virtual processor. In box 215, the data structure is initialized, for example, by storing the physical interrupt vectors and for each, a desired configuration bit.

In box 216, an address of a memory location for storing a data structure to map the physical interrupt vectors to virtual interrupt vectors is written to address field 136. The data structure (e.g., vector redirection map 137) may include an entry for each of the physical interrupt vectors. Each entry may include a virtual interrupt vector corresponding to the physical interrupt vector for each interrupt to be delivered to the virtual processor. Such remapping may be used, for example, to account for the remapping of system memory 130, or a portion of system memory 130, to the memory allocated to the VM that includes the virtual processor. In box 217, the data structure is initialized, for example, by storing the physical interrupt vectors and for each, a desired virtual interrupt vector.

FIG. 3 illustrates an embodiment of the present invention in a method for delivering interrupts directly to virtual processors.

In box 310 of FIG. 3, a VM entry is performed and control is transferred to a guest. In box 320, the guest begins or continues to run on a virtual processor in the VM. In box 330, interface 121 receives an interrupt request. The interrupt request may be from an interrupt controller, such as interrupt controller 122 or 112, or any other device. In some embodiments, the interrupt may be an inter-processor interrupt generated by another physical processor, or generated by a guest to its own virtual processor.

In box 340, control logic 125 checks interrupt-assignment control bit 133 to determine if direct delivery of interrupts to the virtual processor is enabled. If direct delivery of interrupts to the virtual processor is not enabled, then, in box 390, exit logic 129 causes a VM exit to occur to allow the VMM to handle the interrupt. In some embodiments, exit logic 129 determines if a VM exit is required in this situation by consulting one or more control bits in the VMCS, e.g., an interrupt-exiting control bit. In some embodiments, exit logic 129 acknowledges the interrupt request and fetches the interrupt vector. In some embodiments, this interrupt acknowledgement as part of a VM exit due to a hardware interrupt may be controlled by one or more control bits in the VMCS, e.g., an acknowledge interrupt on exit control bit.

However, if direct delivery of interrupts to the virtual processor is enabled, then, in box 350, interrupt acknowledge logic 126 acknowledges the interrupt request, for example, by sending an interrupt acknowledge message. In an embodiment where the processor includes a local APIC, the interrupt request is acknowledged at the local APIC. In box 352, processor 120 receives the physical interrupt vector. In an embodiment where the processor includes a local APIC, acknowledgement of the interrupt request may also cause the interrupt request register (“IRR”), in-service register (“ISR”), and processor priority register (“PPR”) to be updated.

In box 360, interrupt delivery logic 127 determines if the interrupt is to be delivered to the virtual processor, for example, by checking interrupt bitmap 135. The determination may also or instead be based on other attributes of the interrupt request, such as a delivery mode (e.g., fixed or user-defined, SMI (system management interrupt), NMI (non-maskable interrupt), MNIT (soft reset), or external) and a trigger mode (e.g., edge or level)). If the interrupt is not to be delivered to the virtual processor, then, in box 390, exit logic 129 causes a VM exit to occur to allow the VMM to handle the interrupt. The physical interrupt vector may be provided to the VMM by storing it in a VM-exit field in the VMCS.

If, however, the interrupt is to be delivered to the virtual processor, then, in box 362, interrupt redirection logic 128 redirects the interrupt for delivery to the virtual processor instead of the physical processor, for example, by translating the physical interrupt vector to a virtual interrupt vector. In this embodiment, the translation is performed by looking up the physical interrupt vector in interrupt vector redirection map 137 to find the corresponding virtual interrupt vector.

In an embodiment including a local APIC, box 362 may also include other actions to properly manage interrupt requests. For example, control logic 125 may cause the end-of-interrupt (“EOI”) register in the local APIC to be cleared, so that the ISR and PPR are updated.

In box 364, the redirected interrupt is delivered to the virtual processor, for example, by using the virtual interrupt vector as in index into an interrupt descriptor table (“IDT”) associated with the virtual processor to find an entry point of an interrupt handler. In some embodiments, the redirected interrupt may be held pending prior to delivery to the virtual processor, depending on the priority of the interrupt. The prioritization may be between interrupts to be delivered to the virtual processor, or may also include interrupts to be delivered to the VMM.

In embodiments with sharable interrupt request lines, any of a variety of techniques may be used to prevent a first interrupt handler associated with a first interrupt request directed to a virtual processor from automatically linking to a second interrupt handler associated with a second interrupt request not directed to the virtual processor. In one embodiment, the EOI register of the local APIC may be cleared with a special message that is not broadcast to I/O APICs. In another embodiment, the determination of whether an interrupt request is to be delivered to a virtual processor may be based on a trigger mode (e.g., edge or level) or other attribute indicating shareability.

Furthermore, in some embodiments the EOI message from an interrupt handler called as a result of a directly delivered interrupt may be intercepted, while in other embodiments a processor may include control logic to handle it without a VM exit. 100441 Within the scope of the present invention, the methods illustrated in FIGS. 2 and 3 may be performed in a different order, with illustrated boxes omitted, with additional boxes added, or with a combination of reordered, omitted, or additional boxes. For example, a VMCS may configure a VMCS in any order, e.g., boxes 212 to 217 may be rearranged in any order.

Processor 120, or any other component or portion of a component designed according to an embodiment of the present invention, may be designed in various stages, from creation to simulation to fabrication. Data representing a design may represent the design in a number of manners. First, as is useful in simulations, the hardware may be represented using a hardware description language or another functional description language. Additionally or alternatively, a circuit level model with logic and/or transistor gates may be produced at some stages of the design process. Furthermore, most designs, at some stage, reach a level where they may be modeled with data representing the physical placement of various devices. In the case where conventional semiconductor fabrication techniques are used, the data representing the device placement model may be the data specifying the presence or absence of various features on different mask layers for masks used to produce an integrated circuit.

In any representation of the design, the data may be stored in any form of a machine-readable medium. An optical or electrical wave modulated or otherwise generated to transmit such information, a memory, or a magnetic or optical storage medium, such as a disc, may be the machine-readable medium. Any of these media may “carry” or “indicate” the design, or other information used in an embodiment of the present invention, such as the instructions in an error recovery routine. When an electrical carrier wave indicating or carrying the information is transmitted, to the extent that copying, buffering, or re-transmission of the electrical signal is performed, a new copy is made. Thus, the actions of a communication provider or a network provider may constitute the making of copies of an article, e.g., a carrier wave, embodying techniques of the present invention.

Thus, apparatuses, methods, and systems for delivering interrupts directly to a virtual processor have been disclosed. While certain embodiments have been described, and shown in the accompanying drawings, it is to be understood that such embodiments are merely illustrative and not restrictive of the broad invention, and that this invention not be limited to the specific constructions and arrangements shown and described, since various other modifications may occur to those ordinarily skilled in the art upon studying this disclosure. In an area of technology such as this, where growth is fast and further advancements are not easily foreseen, the disclosed embodiments may be readily modifiable in arrangement and detail as facilitated by enabling technological advancements without departing from the principles of the present disclosure or the scope of the accompanying claims. 

1. An apparatus comprising: an interface to receive an interrupt request while a guest is running on a virtual processor; delivery logic to determine, based on an attribute of the interrupt request, whether the interrupt request is to be delivered to the virtual processor; and exit logic to transfer control of the apparatus from the guest to a host if the delivery logic determines that the interrupt request is not to be delivered to the virtual processor.
 2. The apparatus of claim 1, wherein the delivery logic is also to deliver the interrupt request to the virtual processor if the delivery logic determines that the interrupt request is to be delivered to the virtual processor.
 3. The apparatus of claim 1, wherein the attribute of the interrupt request includes one of a physical interrupt vector, a delivery mode, and a trigger mode.
 4. The apparatus of claim 1, wherein: the interface is also to receive a physical interrupt vector; and the delivery logic is to determine whether the interrupt request is to be delivered to the virtual processor based on the physical interrupt vector.
 5. The apparatus of claim 4, wherein the delivery logic is to determine whether the interrupt request is to be delivered to the virtual processor based on an entry for the physical interrupt vector in an interrupt delivery data structure.
 6. The apparatus of claim 4, further comprising acknowledge logic to acknowledge the interrupt request to cause delivery of the physical interrupt vector.
 7. The apparatus of claim 4, further comprising redirection logic to translate the physical interrupt vector to a virtual interrupt vector.
 8. The apparatus of claim 7, wherein the redirection logic is to translate the physical interrupt vector to a virtual interrupt vector based on an entry in an interrupt redirection data structure.
 9. A method comprising: receiving an interrupt request while a guest is running on a virtual processor; determining, based on an attribute of the interrupt request, whether the interrupt request is to be delivered to the virtual processor; and transferring control from the guest to a host if the interrupt request is not to be delivered to the virtual processor.
 10. The method of claim 9, wherein the attribute of the interrupt request includes one of a physical interrupt vector, a delivery mode, and a trigger mode.
 11. The method of claim 9, further comprising receiving a physical interrupt vector.
 12. The method of claim 11, wherein determining whether the interrupt request is to be delivered to the virtual processor is based on the physical interrupt vector.
 13. The method of claim 12, wherein determining whether the interrupt request is to be delivered to the virtual processor is based on an entry for the physical interrupt vector in an interrupt delivery data structure.
 14. The method of claim 11, further comprising acknowledging the interrupt request to cause delivery of the physical interrupt vector.
 15. The method of claim 11, further comprising translating the physical interrupt vector to a virtual interrupt vector.
 16. The method of claim 15, wherein translating the physical interrupt vector to a virtual interrupt vector is based on an entry in an interrupt redirection data structure.
 17. A system comprising: a memory to store a data structure to control a virtual machine having a virtual processor; and a physical processor including: an interface to receive an interrupt request; delivery logic to determine, based on an attribute of the interrupt request, whether the interrupt request is to be delivered to the virtual processor; and exit logic to transfer control of the processor from a guest to a host if the delivery logic determines that the interrupt request is not to be delivered to the virtual processor.
 18. The system of claim 17, wherein: the interface is also to receive a physical interrupt vector; and the delivery logic is to determine whether the interrupt request is to be delivered to the virtual processor based on the physical interrupt vector.
 19. The system of claim 18, wherein the delivery logic is to determine whether the interrupt request is to be delivered to the virtual processor based on entry for the physical interrupt vector in the data structure.
 20. The system of claim 18, further comprising redirection logic to translate the physical interrupt vector to a virtual interrupt vector.
 21. The system of claim 20, wherein the redirection logic is to translate the physical interrupt vector to a virtual interrupt vector based on an interrupt redirection map in the data structure. 